﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using DataAccessClasses;

namespace LotteryBO
{
    class Players_info
    {
        iDAC dac = DACFactory.GetDAC();
        private long _player_id = -99;
        private long _lottery_id = -99;
        private string _date_of_ticket = "1/1/1800";
        private long _ticket_amt = -99;
        private bool _isdeleted = false;

        public bool isdeleted
        {
            get
            {
                return _isdeleted;
            }
            set
            {
                _isdeleted = value;
            }
        }
        public long player_id
        {
            get
            {
                return _player_id;
            }
            set
            {
                _player_id = value;
            }
        }
        public long lottery_id
        {
            get
            {
                return _lottery_id;
            }
            set
            {
                _lottery_id = value;
            }
        }
        public string date_of_ticket
        {
            get
            {
                return _date_of_ticket;
            }
            set
            {
                _date_of_ticket = value;
            }
        }
        public long ticket_amt
        {
            get
            {
                return _ticket_amt;
            }
            set
            {
                _ticket_amt = value;
            }
        }
        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = dac.Parameter("@player_id", player_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = dac.Parameter("@lottery_id", lottery_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = dac.Parameter("@date_of_ticket", date_of_ticket, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = dac.Parameter("@ticket_amt",ticket_amt, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam4 = dac.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4 };
                return dac.Save("Players_info_save", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long player_id,long lottery_id, string date_of_ticket,long ticket_amt,bool isdeleted, string andor)
        {
            try
            {
                DbParameter dbparam0 = dac.Parameter("@player_id", player_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = dac.Parameter("@lottery_id", lottery_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = dac.Parameter("@date_of_ticket", date_of_ticket, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = dac.Parameter("@ticket_amt", ticket_amt, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam4 = dac.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4 };
                DataTable dt1 = dac.Select("Players_info_get", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }
        
    }
}
